package com.xcc.seata.order.controller;

import com.xcc.entities.CommonResult;
import com.xcc.seata.order.domain.Order;
import com.xcc.seata.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    @Autowired
    OrderService orderService;

    //http://localhost:2001/create?userId=1&productId=1&count=10&money=100
    @RequestMapping("/create")
    public CommonResult<String> create(Order order) {
        return new CommonResult(200,"插入成功",orderService.create(order));
    }

    @RequestMapping("/update")
    public CommonResult<String> update(Long id,Integer status) {
        orderService.update(id,status);
        return new CommonResult<>(200,"修改成功");
    }

}
